package com.example.a1018;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class zcActivity extends AppCompatActivity {
  private TextView textView3;
  private EditText editTextTextPersonName2;
    private TextView textView4;
    private EditText editTextTextPersonName3;
    private TextView textView5;
    private EditText editTextTextPersonName4;
    private TextView textView6;
    private EditText editTextTextPersonName5;
    private Button button;
    private Button button2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zc);
        textView3=(TextView) findViewById(R.id.textView3);
      editTextTextPersonName2=(EditText) findViewById(R.id.editTextTextPersonName2);
      textView4=(TextView) findViewById(R.id.textView4);
      editTextTextPersonName3=(EditText) findViewById(R.id.editTextTextPersonName3);
      textView5=(TextView) findViewById(R.id.textView5);
      editTextTextPersonName4=(EditText) findViewById(R.id.editTextTextPersonName4);
      textView6=(TextView) findViewById(R.id.textView6);
      editTextTextPersonName5=(EditText) findViewById(R.id.editTextTextPersonName5);
      button=(Button)findViewById(R.id.button);
      button2=(Button)findViewById(R.id.button2);
    }

    public void dl(View view) {
      setResult(Activity.RESULT_CANCELED);
      finish();
    }

    public void zc(View view) {
    if (textView3.getText().toString().length()>4){
      Intent intent=new Intent(this,LoginActivity.class);
      intent.putExtra("username",editTextTextPersonName2.getText().toString());
      intent.putExtra("password",editTextTextPersonName3.getText().toString());
      intent.putExtra("age",editTextTextPersonName4.getText().toString());
      intent.putExtra("sex",editTextTextPersonName5.getText().toString());
      setResult(Activity.RESULT_OK,intent);
      finish();
    }else{
      Toast.makeText(this,"请输入合法的用户名和密码",Toast.LENGTH_SHORT).show();
    }
    }
}